/*
** Lua binding: inherit
** Generated automatically by tolua++-1.0.92 on 05/26/16 11:27:31.
*/

#ifndef __cplusplus
#include "stdlib.h"
#endif
#include "string.h"

#include "tolua++.h"

/* Exported function */
extern "C" __declspec(dllexport) int  tolua_inherit_open (lua_State* tolua_S);

#include "inheritance.h"

/* function to release collected object via destructor */
#ifdef __cplusplus

static int tolua_collect_Derive (lua_State* tolua_S)
{
 Derive* self = (Derive*) tolua_tousertype(tolua_S,1,0);
	delete self;
	return 0;
}

static int tolua_collect_Point (lua_State* tolua_S)
{
 Point* self = (Point*) tolua_tousertype(tolua_S,1,0);
	delete self;
	return 0;
}

static int tolua_collect_Base (lua_State* tolua_S)
{
 Base* self = (Base*) tolua_tousertype(tolua_S,1,0);
	delete self;
	return 0;
}
#endif


/* function to register type */
static void tolua_reg_types (lua_State* tolua_S)
{
 tolua_usertype(tolua_S,"Derive");
 tolua_usertype(tolua_S,"Point");
 tolua_usertype(tolua_S,"Base");
}

/* method: new of class  Base */
#ifndef TOLUA_DISABLE_tolua_inherit_Base_new00
static int tolua_inherit_Base_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"Base",0,&tolua_err) ||
     !tolua_isnumber(tolua_S,2,1,&tolua_err) ||
     !tolua_isnoobj(tolua_S,3,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  Color color = ((Color) (int)  tolua_tonumber(tolua_S,2,WHITE));
  {
   Base* tolua_ret = (Base*)  new Base(color);
   tolua_pushusertype(tolua_S,(void*)tolua_ret,"Base");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: new_local of class  Base */
#ifndef TOLUA_DISABLE_tolua_inherit_Base_new00_local
static int tolua_inherit_Base_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"Base",0,&tolua_err) ||
     !tolua_isnumber(tolua_S,2,1,&tolua_err) ||
     !tolua_isnoobj(tolua_S,3,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  Color color = ((Color) (int)  tolua_tonumber(tolua_S,2,WHITE));
  {
   Base* tolua_ret = (Base*)  new Base(color);
   tolua_pushusertype_and_takeownership(tolua_S,(void *)tolua_ret,"Base");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: delete of class  Base */
#ifndef TOLUA_DISABLE_tolua_inherit_Base_delete00
static int tolua_inherit_Base_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"Base",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  Base* self = (Base*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'",NULL);
#endif
  delete self;
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: SetColor of class  Base */
#ifndef TOLUA_DISABLE_tolua_inherit_Base_SetColor00
static int tolua_inherit_Base_SetColor00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"Base",0,&tolua_err) ||
     !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,3,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  Base* self = (Base*)  tolua_tousertype(tolua_S,1,0);
  Color color = ((Color) (int)  tolua_tonumber(tolua_S,2,0));
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetColor'",NULL);
#endif
  {
   self->SetColor(color);
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'SetColor'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: GetColor of class  Base */
#ifndef TOLUA_DISABLE_tolua_inherit_Base_GetColor00
static int tolua_inherit_Base_GetColor00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"Base",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  Base* self = (Base*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetColor'",NULL);
#endif
  {
   Color tolua_ret = (Color)  self->GetColor();
   tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'GetColor'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: new of class  Point */
#ifndef TOLUA_DISABLE_tolua_inherit_Point_new00
static int tolua_inherit_Point_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"Point",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  {
   Point* tolua_ret = (Point*)  new Point();
   tolua_pushusertype(tolua_S,(void*)tolua_ret,"Point");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: new_local of class  Point */
#ifndef TOLUA_DISABLE_tolua_inherit_Point_new00_local
static int tolua_inherit_Point_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"Point",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  {
   Point* tolua_ret = (Point*)  new Point();
   tolua_pushusertype_and_takeownership(tolua_S,(void *)tolua_ret,"Point");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: delete of class  Point */
#ifndef TOLUA_DISABLE_tolua_inherit_Point_delete00
static int tolua_inherit_Point_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"Point",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  Point* self = (Point*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'",NULL);
#endif
  delete self;
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* get function: x of class  Point */
#ifndef TOLUA_DISABLE_tolua_get_Point_x
static int tolua_get_Point_x(lua_State* tolua_S)
{
  Point* self = (Point*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'x'",NULL);
#endif
  tolua_pushnumber(tolua_S,(lua_Number)self->x);
 return 1;
}
#endif //#ifndef TOLUA_DISABLE

/* set function: x of class  Point */
#ifndef TOLUA_DISABLE_tolua_set_Point_x
static int tolua_set_Point_x(lua_State* tolua_S)
{
  Point* self = (Point*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  tolua_Error tolua_err;
  if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'x'",NULL);
  if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
   tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  self->x = ((int)  tolua_tonumber(tolua_S,2,0))
;
 return 0;
}
#endif //#ifndef TOLUA_DISABLE

/* get function: y of class  Point */
#ifndef TOLUA_DISABLE_tolua_get_Point_y
static int tolua_get_Point_y(lua_State* tolua_S)
{
  Point* self = (Point*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'y'",NULL);
#endif
  tolua_pushnumber(tolua_S,(lua_Number)self->y);
 return 1;
}
#endif //#ifndef TOLUA_DISABLE

/* set function: y of class  Point */
#ifndef TOLUA_DISABLE_tolua_set_Point_y
static int tolua_set_Point_y(lua_State* tolua_S)
{
  Point* self = (Point*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  tolua_Error tolua_err;
  if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'y'",NULL);
  if (!tolua_isnumber(tolua_S,2,0,&tolua_err))
   tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);
#endif
  self->y = ((int)  tolua_tonumber(tolua_S,2,0))
;
 return 0;
}
#endif //#ifndef TOLUA_DISABLE

/* method: new of class  Derive */
#ifndef TOLUA_DISABLE_tolua_inherit_Derive_new00
static int tolua_inherit_Derive_new00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"Derive",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  {
   Derive* tolua_ret = (Derive*)  new Derive();
   tolua_pushusertype(tolua_S,(void*)tolua_ret,"Derive");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: new_local of class  Derive */
#ifndef TOLUA_DISABLE_tolua_inherit_Derive_new00_local
static int tolua_inherit_Derive_new00_local(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertable(tolua_S,1,"Derive",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  {
   Derive* tolua_ret = (Derive*)  new Derive();
   tolua_pushusertype_and_takeownership(tolua_S,(void *)tolua_ret,"Derive");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: delete of class  Derive */
#ifndef TOLUA_DISABLE_tolua_inherit_Derive_delete00
static int tolua_inherit_Derive_delete00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"Derive",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  Derive* self = (Derive*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'",NULL);
#endif
  delete self;
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: GetPoint of class  Derive */
#ifndef TOLUA_DISABLE_tolua_inherit_Derive_GetPoint00
static int tolua_inherit_Derive_GetPoint00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"Derive",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  Derive* self = (Derive*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPoint'",NULL);
#endif
  {
   Point& tolua_ret = (Point&)  self->GetPoint();
   tolua_pushusertype(tolua_S,(void*)&tolua_ret,"Point");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'GetPoint'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* method: SetPoint of class  Derive */
#ifndef TOLUA_DISABLE_tolua_inherit_Derive_SetPoint00
static int tolua_inherit_Derive_SetPoint00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"Derive",0,&tolua_err) ||
     !tolua_isusertype(tolua_S,2,"Point",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,3,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  Derive* self = (Derive*)  tolua_tousertype(tolua_S,1,0);
  Point* point = ((Point*)  tolua_tousertype(tolua_S,2,0));
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPoint'",NULL);
#endif
  {
   self->SetPoint(*point);
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'SetPoint'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* Open function */
int tolua_inherit_open (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,0);
 tolua_beginmodule(tolua_S,NULL);
  tolua_constant(tolua_S,"YELLOW",YELLOW);
  tolua_constant(tolua_S,"BLUE",BLUE);
  tolua_constant(tolua_S,"GREEN",GREEN);
  tolua_constant(tolua_S,"RED",RED);
  tolua_constant(tolua_S,"WHITE",WHITE);
  tolua_constant(tolua_S,"BLACK",BLACK);
  #ifdef __cplusplus
  tolua_cclass(tolua_S,"Base","Base","",tolua_collect_Base);
  #else
  tolua_cclass(tolua_S,"Base","Base","",NULL);
  #endif
  tolua_beginmodule(tolua_S,"Base");
   tolua_function(tolua_S,"new",tolua_inherit_Base_new00);
   tolua_function(tolua_S,"new_local",tolua_inherit_Base_new00_local);
   tolua_function(tolua_S,".call",tolua_inherit_Base_new00_local);
   tolua_function(tolua_S,"delete",tolua_inherit_Base_delete00);
   tolua_function(tolua_S,"SetColor",tolua_inherit_Base_SetColor00);
   tolua_function(tolua_S,"GetColor",tolua_inherit_Base_GetColor00);
  tolua_endmodule(tolua_S);
  #ifdef __cplusplus
  tolua_cclass(tolua_S,"Point","Point","",tolua_collect_Point);
  #else
  tolua_cclass(tolua_S,"Point","Point","",NULL);
  #endif
  tolua_beginmodule(tolua_S,"Point");
   tolua_function(tolua_S,"new",tolua_inherit_Point_new00);
   tolua_function(tolua_S,"new_local",tolua_inherit_Point_new00_local);
   tolua_function(tolua_S,".call",tolua_inherit_Point_new00_local);
   tolua_function(tolua_S,"delete",tolua_inherit_Point_delete00);
   tolua_variable(tolua_S,"x",tolua_get_Point_x,tolua_set_Point_x);
   tolua_variable(tolua_S,"y",tolua_get_Point_y,tolua_set_Point_y);
  tolua_endmodule(tolua_S);
  #ifdef __cplusplus
  tolua_cclass(tolua_S,"Derive","Derive","Base",tolua_collect_Derive);
  #else
  tolua_cclass(tolua_S,"Derive","Derive","Base",NULL);
  #endif
  tolua_beginmodule(tolua_S,"Derive");
   tolua_function(tolua_S,"new",tolua_inherit_Derive_new00);
   tolua_function(tolua_S,"new_local",tolua_inherit_Derive_new00_local);
   tolua_function(tolua_S,".call",tolua_inherit_Derive_new00_local);
   tolua_function(tolua_S,"delete",tolua_inherit_Derive_delete00);
   tolua_function(tolua_S,"GetPoint",tolua_inherit_Derive_GetPoint00);
   tolua_function(tolua_S,"SetPoint",tolua_inherit_Derive_SetPoint00);
  tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 return 1;
}


#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
 int luaopen_inherit (lua_State* tolua_S) {
 return tolua_inherit_open(tolua_S);
};
#endif

